package com.thread;

import com.alibaba.fastjson.JSON;
import com.controller.MsgHandler;
import org.springframework.web.socket.TextMessage;
import sys.model.UserEmail;

/**
 * Created by shugen on 2017/3/12.
 */
public class QQmailThread extends Thread{
    private Object o;
    public QQmailThread(Object o){
        this.o=o;
    }
    //线程启动入口
    public void run() {
        if(o!=null&&o.getClass()==UserEmail.class)
            doEmail();
    }






    private void doEmail() {
        UserEmail userEmail=(UserEmail)o;
        MsgHandler.sendMessageToUser("userid-"+userEmail.getReceverid(),new TextMessage( JSON.toJSONString(userEmail)));

    }
}
